home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / VBSamples / Demos / AirHockey / frmSplash.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-10-08  |  9.2 KB  |  276 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Begin VB.Form frmSplash 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "vb Air Hockey"
  6.    ClientHeight    =   5400
  7.    ClientLeft      =   45
  8.    ClientTop       =   330
  9.    ClientWidth     =   7200
  10.    Icon            =   "frmSplash.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   5400
  15.    ScaleWidth      =   7200
  16.    StartUpPosition =   3  'Windows Default
  17.    Begin VB.Frame Frame1 
  18.       Caption         =   "Options"
  19.       Height          =   2115
  20.       Left            =   60
  21.       TabIndex        =   5
  22.       Top             =   720
  23.       Width           =   7095
  24.       Begin VB.CommandButton cmdAudio 
  25.          Caption         =   "&Audio Options..."
  26.          Height          =   375
  27.          Left            =   5040
  28.          TabIndex        =   15
  29.          Top             =   1560
  30.          Width           =   1815
  31.       End
  32.       Begin VB.CommandButton cmdInput 
  33.          Caption         =   "&Input Options..."
  34.          Height          =   375
  35.          Left            =   5040
  36.          TabIndex        =   14
  37.          Top             =   1080
  38.          Width           =   1815
  39.       End
  40.       Begin VB.CommandButton cmdGraphicsOptions 
  41.          Caption         =   "&Graphics Options..."
  42.          Height          =   375
  43.          Left            =   5040
  44.          TabIndex        =   13
  45.          Top             =   600
  46.          Width           =   1815
  47.       End
  48.       Begin MSComctlLib.Slider sldSpeed 
  49.          Height          =   255
  50.          Left            =   150
  51.          TabIndex        =   7
  52.          Top             =   870
  53.          Width           =   2055
  54.          _ExtentX        =   3625
  55.          _ExtentY        =   450
  56.          _Version        =   393216
  57.          LargeChange     =   50
  58.          SmallChange     =   5
  59.          Min             =   10
  60.          Max             =   1000
  61.          SelStart        =   10
  62.          TickFrequency   =   100
  63.          Value           =   10
  64.       End
  65.       Begin MSComctlLib.Slider sldScore 
  66.          Height          =   255
  67.          Left            =   150
  68.          TabIndex        =   8
  69.          Top             =   1470
  70.          Width           =   2055
  71.          _ExtentX        =   3625
  72.          _ExtentY        =   450
  73.          _Version        =   393216
  74.          LargeChange     =   3
  75.          Min             =   2
  76.          Max             =   20
  77.          SelStart        =   10
  78.          TickFrequency   =   2
  79.          Value           =   10
  80.       End
  81.       Begin MSComctlLib.Slider sldPaddleMass 
  82.          Height          =   255
  83.          Left            =   2310
  84.          TabIndex        =   10
  85.          Top             =   870
  86.          Width           =   2055
  87.          _ExtentX        =   3625
  88.          _ExtentY        =   450
  89.          _Version        =   393216
  90.          LargeChange     =   50
  91.          SmallChange     =   5
  92.          Min             =   50
  93.          Max             =   300
  94.          SelStart        =   50
  95.          TickFrequency   =   20
  96.          Value           =   50
  97.       End
  98.       Begin VB.Label Label3 
  99.          BackStyle       =   0  'Transparent
  100.          Caption         =   $"frmSplash.frx":000C
  101.          Height          =   435
  102.          Left            =   60
  103.          TabIndex        =   12
  104.          Top             =   180
  105.          Width           =   6930
  106.       End
  107.       Begin VB.Label Label2 
  108.          BackStyle       =   0  'Transparent
  109.          Caption         =   "Paddle Mass"
  110.          Height          =   255
  111.          Index           =   2
  112.          Left            =   2430
  113.          TabIndex        =   11
  114.          Top             =   630
  115.          Width           =   3615
  116.       End
  117.       Begin VB.Label Label2 
  118.          BackStyle       =   0  'Transparent
  119.          Caption         =   "Winning Score"
  120.          Height          =   255
  121.          Index           =   1
  122.          Left            =   270
  123.          TabIndex        =   9
  124.          Top             =   1230
  125.          Width           =   1215
  126.       End
  127.       Begin VB.Label Label2 
  128.          BackStyle       =   0  'Transparent
  129.          Caption         =   "Game Speed"
  130.          Height          =   255
  131.          Index           =   0
  132.          Left            =   270
  133.          TabIndex        =   6
  134.          Top             =   630
  135.          Width           =   1215
  136.       End
  137.    End
  138.    Begin VB.CommandButton cmdExit 
  139.       Cancel          =   -1  'True
  140.       Caption         =   "Exit Game"
  141.       Height          =   375
  142.       Left            =   5220
  143.       TabIndex        =   2
  144.       Top             =   4860
  145.       Width           =   1815
  146.    End
  147.    Begin VB.CommandButton cmdSingle 
  148.       Caption         =   "&Single Player Game..."
  149.       Height          =   375
  150.       Left            =   5220
  151.       TabIndex        =   0
  152.       Top             =   4020
  153.       Width           =   1815
  154.    End
  155.    Begin VB.CommandButton cmdMulti 
  156.       Caption         =   "&Multiplayer Game..."
  157.       Height          =   375
  158.       Left            =   5220
  159.       TabIndex        =   1
  160.       Top             =   4440
  161.       Width           =   1815
  162.    End
  163.    Begin VB.Label lblText 
  164.       BackStyle       =   0  'Transparent
  165.       Caption         =   "Label2"
  166.       ForeColor       =   &H80000008&
  167.       Height          =   2340
  168.       Left            =   180
  169.       TabIndex        =   4
  170.       Top             =   2895
  171.       Width           =   4920
  172.    End
  173.    Begin VB.Label Label1 
  174.       Alignment       =   2  'Center
  175.       BackStyle       =   0  'Transparent
  176.       Caption         =   "Visual Basic Air Hockey"
  177.       BeginProperty Font 
  178.          Name            =   "Comic Sans MS"
  179.          Size            =   21.75
  180.          Charset         =   0
  181.          Weight          =   700
  182.          Underline       =   0   'False
  183.          Italic          =   0   'False
  184.          Strikethrough   =   0   'False
  185.       EndProperty
  186.       ForeColor       =   &H000000FF&
  187.       Height          =   675
  188.       Left            =   120
  189.       TabIndex        =   3
  190.       Top             =   0
  191.       Width           =   6915
  192.    End
  193. Attribute VB_Name = "frmSplash"
  194. Attribute VB_GlobalNameSpace = False
  195. Attribute VB_Creatable = False
  196. Attribute VB_PredeclaredId = True
  197. Attribute VB_Exposed = False
  198. Option Explicit
  199. Dim fStartingGame As Boolean
  200. Private Sub cmdAudio_Click()
  201.     'Here we will allow the changing of the audio options.
  202.     'Load the options screen
  203.     frmAudio.Show vbModal, Me
  204. End Sub
  205. Private Sub cmdExit_Click()
  206.     'Quit the game
  207.     Unload Me
  208. End Sub
  209. Private Sub cmdGraphicsOptions_Click()
  210.     'Here we will allow the changing of the graphics options.
  211.     'Load the options screen
  212.     frmGraphics.Show vbModal, Me
  213. End Sub
  214. Private Sub cmdInput_Click()
  215.     'Here we will allow the changing of the input options.
  216.     'Load the options screen
  217.     frmInput.Show vbModal, Me
  218. End Sub
  219. Private Sub cmdMulti_Click()
  220.     fStartingGame = True
  221.     SaveAll
  222.     gfMultiplayer = True
  223.     gfGameCanBeStarted = False
  224.     'Go ahead and load the game
  225.     frmAir.Show vbModeless
  226. End Sub
  227. Private Sub cmdSingle_Click()
  228.     fStartingGame = True
  229.     SaveAll
  230.     gfMultiplayer = False
  231.     gfGameCanBeStarted = True
  232.     'Go ahead and load the game
  233.     frmAir.Show vbModeless
  234. End Sub
  235. Private Sub Form_Load()
  236.     gfScored = True
  237.     sldSpeed.Value = CLng(GetSetting(gsKeyName, gsSubKey, "Speed", 780))
  238.     sldScore.Value = CLng(GetSetting(gsKeyName, gsSubKey, "WinningScore", glDefaultWinningScore))
  239.     sldPaddleMass.Value = CLng(GetSetting(gsKeyName, gsSubKey, "PaddleMass", 100))
  240.     lblText.Caption = "Options during gameplay:" & vbCrLf & vbCrLf & _
  241.         "<Space> Start game (launch puck from center)" & vbCrLf & _
  242.         "<F1> Toggle showing the game room" & vbCrLf & _
  243.         "<F3> Restart the game after someone has won" & vbCrLf & _
  244.         "<F4> Toggle the game tables transparency" & vbCrLf & _
  245.         "<F5> Toggle showing the game table" & vbCrLf & _
  246.         "<F6> Toggle the paddles transparency" & vbCrLf & _
  247.         "<V> Scroll through default views" & vbCrLf & _
  248.         "<W> Toggle wireframe mode" & vbCrLf & vbCrLf & _
  249.         "Use the right mouse button to get a different view."
  250.     'Init objects and load values
  251.     LoadObjects
  252. End Sub
  253. Private Sub Form_Unload(Cancel As Integer)
  254.     If Not fStartingGame Then 'We're not starting, cleanup
  255.         Set goPuck = Nothing
  256.         Set goPaddle(0) = Nothing
  257.         Set goPaddle(1) = Nothing
  258.         Set goCamera = Nothing
  259.         Set goTable = Nothing
  260.         Set goRoom = Nothing
  261.         Set goInput = Nothing
  262.         Set goAudio = New cAudio
  263.         Set goDev = Nothing
  264.         End
  265.     End If
  266. End Sub
  267. Private Sub SaveAll()
  268.     gnVelocityDamp = sldSpeed.Value / 1000
  269.     glUserWinningScore = sldScore.Value
  270.     gnPaddleMass = sldPaddleMass.Value / 100
  271.     goPuck.MaximumPuckVelocity = gnVelocityDamp * glMaxPuckSpeedConstant
  272.     SaveSetting gsKeyName, gsSubKey, "Speed", CStr(sldSpeed.Value)
  273.     SaveSetting gsKeyName, gsSubKey, "WinningScore", CStr(sldScore.Value)
  274.     SaveSetting gsKeyName, gsSubKey, "PaddleMass", CStr(sldPaddleMass.Value)
  275. End Sub
  276.